<template>
    <div>
        <div class="dietitian-code">
            <img class="dietitian-bj" src="../../../static/img/code-bj.png" alt="">
            <img class="code-pic" :src="imgPath" alt="">
            <div class="dietitian-yqm clearfix">
                <img class="dietitian-yqm-img" src="../../../static/img/left.png" alt="" srcset="">
                <span class="yaoqingma">邀请码</span>
                <img class="dietitian-yqm-img" src="../../../static/img/right.png" alt="" srcset="">
            </div>
            <img class="code-ewm" :src="ewm" alt="">
            <span class="code-saoma">{{fromMessage}}</span>
            <a :href="ewm" class="code-baocun" download="">保存二维码</a>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return{
            fromMessage:'',
            ewm:'',
            imgPath:this.$route.query.imgPath
        }
    },
    mounted(){
        if(this.$route.query.codeTitle=='dealers'){
            this.fromMessage = '扫码关注经销商'
        }else{
            this.fromMessage = '扫码关注营养师'
        }
        this.showQrcode()
    },
    methods:{
        // 营养师的二维码
        showQrcode(){
            this.$api.dietitian.showQrcode().then(resp=>{
                if(resp.code == 1){
                    this.ewm = resp.data
                }
            })
        }
    }
}
</script>

<style lang="less" scoped>
.dietitian-code{
    margin: 0 20px;
    text-align: center;
    position: relative;
    .dietitian-bj{
        margin-top: 260px;
    }
    .code-pic{
        position: absolute;
        left: 50%;
        top: 130px;
        width: 249px;
        margin-left: -125px;
        height: 249px;
        border-radius: 50%;
        border:#5CA1EE solid 6px;
    }
    .dietitian-yqm{
        position: absolute;
        left: 0;
        top:430px;
        width: 100%;
        .dietitian-yqm-img{
            width: 198px;
            height: 40.5px;
            vertical-align: middle;
        }
        .yaoqingma{
            width: 30%;
            display: inline-block;
            color: #5CA1EE;
            font-size: 42px;
            font-weight: bold;
            line-height: 45px;
            height: 45px;
        }
    }
    .code-ewm{
        position: absolute;
        left: 50%;
        margin-left: -151px;
        width: 302px;
        height: 302px;
        top:530px;
    }
    .code-saoma{
        position: absolute;
        left: 0;
        top:860px;
        display: block;
        font-size: 36px;
        color: #666;
        text-align: center;
        width: 100%;
        height: 80px;
        line-height: 80px;
    }
    .code-baocun{
        position: absolute;
        left: 50%;
        margin-left: -175px;
        top:990px;
        display: block;
        font-size: 36px;
        color: #fff;
        text-align: center;
        width: 350px;
        height: 100px;
        line-height: 100px;
        background-color: #5CA1EE;
        overflow: hidden;
        border-radius: 10px;
    }
}
</style>

